<!DOCTYPE HTML>
<html lang="en" >
    
    <head>
        
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>Yaml介绍 | 移动端测试课程介绍</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="../gitbook/style.css">
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-splitter/splitter.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-chapter-fold/chapter-fold.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="../day5/pyyaml.html" />
    
    
    <link rel="prev" href="../day5/readme.html" />
    

        
    </head>
    <body>
        
        
    <div class="book"
        data-level="5.1"
        data-chapter-title="Yaml介绍"
        data-filepath="day5/introduction_yaml.md"
        data-basepath=".."
        data-revision="Sat Jun 08 2019 07:44:25 GMT+0800 (CST)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../index.html">
                
                        <i class="fa fa-check"></i>
                        
                        Introduction
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="day1/readme.html">
            
                
                    <a href="../day1/readme.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        移动入门
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1" data-path="day1/app_test_knowledge.html">
            
                
                    <a href="../day1/app_test_knowledge.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.</b>
                        
                        移动端测试概述
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="day1/create_env/readme.html">
            
                
                    <a href="../day1/create_env/readme.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.</b>
                        
                        移动测试环境搭建搭建
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="day1/create_env/java.html">
            
                
                    <a href="../day1/create_env/java.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.1.</b>
                        
                        Java环境搭建
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="day1/create_env/sdk.html">
            
                
                    <a href="../day1/create_env/sdk.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.2.</b>
                        
                        Android sdk 环境
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="day1/create_env/geny.html">
            
                
                    <a href="../day1/create_env/geny.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.3.</b>
                        
                        Android 虚拟机安装
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="day1/command_adb.html">
            
                
                    <a href="../day1/command_adb.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.</b>
                        
                        ADB命令
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="day1/app_tools.html">
            
                
                    <a href="../day1/app_tools.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.</b>
                        
                        移动端自动化工具
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="day1/appium_env.html">
            
                
                    <a href="../day1/appium_env.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.5.</b>
                        
                        appium环境搭建
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="day1/start_appium.html">
            
                
                    <a href="../day1/start_appium.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.6.</b>
                        
                        appium入门案例
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2" data-path="day2/readme.html">
            
                
                    <a href="../day2/readme.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        app操作api
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1" data-path="day2/base_api.html">
            
                
                    <a href="../day2/base_api.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        app基础操作api
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="day2/uiauto.html">
            
                
                    <a href="../day2/uiauto.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.</b>
                        
                        uiautomatorviewer工具
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="day2/location_element.html">
            
                
                    <a href="../day2/location_element.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.</b>
                        
                        app元素定位操作api
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="day2/get_infor.html">
            
                
                    <a href="../day2/get_infor.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.</b>
                        
                        根据元素获取信息api
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="day2/element_event.html">
            
                
                    <a href="../day2/element_event.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.5.</b>
                        
                        元素事件操作
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.6" data-path="day2/touch_action.html">
            
                
                    <a href="../day2/touch_action.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.6.</b>
                        
                        模拟手势操作
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.7" data-path="day2/phone_api.html">
            
                
                    <a href="../day2/phone_api.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.7.</b>
                        
                        手机操作api
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3" data-path="day3/readme.html">
            
                
                    <a href="../day3/readme.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        Pytest
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1" data-path="day3/install_introduction.html">
            
                
                    <a href="../day3/install_introduction.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.1.</b>
                        
                        pytest安装和介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="day3/setup_teardown.html">
            
                
                    <a href="../day3/setup_teardown.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.</b>
                        
                        setup和teardown函数
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="day3/pytest_config.html">
            
                
                    <a href="../day3/pytest_config.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.3.</b>
                        
                        pytest的配置文件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.4" data-path="day3/middle.html">
            
                
                    <a href="../day3/middle.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.4.</b>
                        
                        pytest常用插件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.5" data-path="day3/pytest_prov1.html">
            
                
                    <a href="../day3/pytest_prov1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.5.</b>
                        
                        pytest提高1--fixture
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.6" data-path="day3/pytest_prov2.html">
            
                
                    <a href="../day3/pytest_prov2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.6.</b>
                        
                        pytest提高2
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4" data-path="day4/readme.html">
            
                
                    <a href="../day4/readme.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                        PO模式
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1" data-path="day4/introduction.html">
            
                
                    <a href="../day4/introduction.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.1.</b>
                        
                        PO模式介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="day4/project_plan.html">
            
                
                    <a href="../day4/project_plan.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.2.</b>
                        
                        项目准备
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="day4/logic.html">
            
                
                    <a href="../day4/logic.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.3.</b>
                        
                        按照业务抽取代码
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.4" data-path="day4/find_element.html">
            
                
                    <a href="../day4/find_element.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.4.</b>
                        
                        抽取的find_element
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.5" data-path="day4/base_action.html">
            
                
                    <a href="../day4/base_action.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.5.</b>
                        
                        抽取基础动作
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5" data-path="day5/readme.html">
            
                
                    <a href="../day5/readme.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.</b>
                        
                        数据驱动--Yaml
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter active" data-level="5.1" data-path="day5/introduction_yaml.html">
            
                
                    <a href="../day5/introduction_yaml.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.1.</b>
                        
                        Yaml介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.2" data-path="day5/pyyaml.html">
            
                
                    <a href="../day5/pyyaml.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.2.</b>
                        
                        python解析yaml文件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.3" data-path="day5/yaml_data.html">
            
                
                    <a href="../day5/yaml_data.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.3.</b>
                        
                        yaml数据驱动案例
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6" data-path="day6/readme.html">
            
                
                    <a href="../day6/readme.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.</b>
                        
                        Allure报告和Jenkins集成
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.1" data-path="day6/allure.html">
            
                
                    <a href="../day6/allure.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.1.</b>
                        
                        allure介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.2" data-path="day6/pytest_allure.html">
            
                
                    <a href="../day6/pytest_allure.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.2.</b>
                        
                        pytest中使用allure
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.3" data-path="day6/jenkins.html">
            
                
                    <a href="../day6/jenkins.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.3.</b>
                        
                        Jenkins安装
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.4" data-path="day6/jenkins_git_allure_email.html">
            
                
                    <a href="../day6/jenkins_git_allure_email.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.4.</b>
                        
                        Jenkins持续集成配置
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    Published with GitBook
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../" >移动端测试课程介绍</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h1 id="yaml&#x4ECB;&#x7ECD;">Yaml&#x4ECB;&#x7ECD;</h1>
<h2 id="&#x5B66;&#x4E60;&#x76EE;&#x6807;">&#x5B66;&#x4E60;&#x76EE;&#x6807;</h2>
<ul>
<li>&#x638C;&#x63E1;&#x6570;&#x636E;&#x7684;&#x5B58;&#x50A8;&#x65B9;&#x5F0F;</li>
<li>&#x4E86;&#x89E3;&#x4EC0;&#x4E48;&#x662F;yaml</li>
</ul>
<h3 id="1-&#x6570;&#x636E;&#x5B58;&#x50A8;&#x65B9;&#x5F0F;">1. &#x6570;&#x636E;&#x5B58;&#x50A8;&#x65B9;&#x5F0F;</h3>
<p>&#x5728;&#x4E86;&#x89E3;&#x6570;&#x636E;&#x7684;&#x5B58;&#x50A8;&#x65B9;&#x5F0F;&#x4E4B;&#x524D;&#x6211;&#x4EEC;&#x8981;&#x5148;&#x77E5;&#x9053;&#x4EC0;&#x4E48;&#x662F;&#x6570;&#x636E;, <strong>&#x6570;&#x636E;&#x5C31;&#x662F;&#x8D44;&#x6E90;,&#x662F;&#x4E00;&#x5207;&#x8D44;&#x6E90;&#x7684;&#x7EDF;&#x79F0;</strong>, &#x6570;&#x636E;&#x6709;&#x4E0D;&#x540C;&#x8868;&#x73B0;&#x65B9;&#x5F0F;&#x548C;&#x5B58;&#x50A8;&#x65B9;&#x5F0F;, &#x4F8B;&#x5982;&#x6587;&#x672C;&#x7C7B;&#x578B;(txt&#x6587;&#x4EF6;&#x3001;doc&#x6587;&#x4EF6;)&#x3001;&#x56FE;&#x7247;&#x3001;&#x97F3;&#x89C6;&#x9891;&#x7B49;&#x90FD;&#x662F;&#x6570;&#x636E;,&#x90FD;&#x6709;&#x4E0D;&#x540C;&#x7684;&#x8868;&#x73B0;&#x5F62;&#x5F0F;.</p>
<p><strong>&#x6570;&#x636E;&#x5B58;&#x50A8;&#x65B9;&#x5F0F;&#x6709;&#x4E0B;&#x9762;4&#x79CD;</strong>:</p>
<ul>
<li>&#x5185;&#x5B58;,&#x5305;&#x62EC;RAM(&#x8FD0;&#x884C;&#x5185;&#x5B58;)&#x548C;ROM(&#x7269;&#x7406;&#x786C;&#x76D8;)&#x4E2D;.</li>
<li>&#x6587;&#x4EF6;, &#x5305;&#x62EC;&#x6587;&#x672C;&#x6587;&#x4EF6;(word&#x3001;excel&#x3001;ppt&#x7B49;&#x7B49;)&#x3001;xml(&#x6807;&#x8BB0;&#x8BED;&#x8A00;)&#x3001;html(&#x8D85;&#x6587;&#x672C;&#x6807;&#x8BB0;&#x8BED;&#x8A00;)&#x3001; json&#x3001;yaml</li>
<li>&#x6570;&#x636E;&#x5E93;, &#x4F8B;&#x5982;mysql&#x3001;oracle&#x3001;sqlserver&#x3001;sqlite&#x7B49;&#x7B49;</li>
<li>&#x7F51;&#x7EDC;</li>
</ul>
<h3 id="2-yaml&#x7B80;&#x4ECB;">2. Yaml&#x7B80;&#x4ECB;</h3>
<blockquote>
<p>Yaml &#x662F;&#x4E00;&#x79CD;&#x6240;&#x6709;&#x7F16;&#x7A0B;&#x8BED;&#x8A00;&#x53EF;&#x7528;&#x7684;&#x53CB;&#x597D;&#x7684;&#x6570;&#x636E;&#x5E8F;&#x5217;&#x5316;&#x6807;&#x51C6;. </p>
<p>&#x5176;&#x8BED;&#x6CD5;&#x548C;&#x5176;&#x4ED6;&#x9AD8;&#x9636;&#x8BED;&#x8A00;&#x7C7B;&#x4F3C;,&#x5E76;&#x4E14;&#x53EF;&#x4EE5;&#x7B80;&#x5355;&#x8868;&#x8FBE;&#x6E05;&#x5355;&#x3001;&#x6563;&#x5217;&#x8868;&#x3001;&#x6807;&#x91CF;&#x7B49;&#x8D44;&#x6599;&#x5F62;&#x5F0F;.</p>
</blockquote>
<h3 id="3-yaml&#x8BED;&#x6CD5;&#x89C4;&#x5219;&#x53CA;&#x652F;&#x6301;&#x7684;&#x6570;&#x636E;&#x7ED3;&#x6784;">3. yaml&#x8BED;&#x6CD5;&#x89C4;&#x5219;&#x53CA;&#x652F;&#x6301;&#x7684;&#x6570;&#x636E;&#x7ED3;&#x6784;</h3>
<h4 id="31-&#x8BED;&#x6CD5;&#x89C4;&#x5219;">3.1 &#x8BED;&#x6CD5;&#x89C4;&#x5219;</h4>
<ol>
<li>&#x5927;&#x5C0F;&#x5199;&#x654F;&#x611F;</li>
<li>&#x4F7F;&#x7528;&#x7F29;&#x8FDB;&#x8868;&#x793A;&#x5C42;&#x7EA7;&#x5173;&#x7CFB;</li>
<li>&#x7F29;&#x8FDB;&#x65F6;&#x4E0D;&#x5141;&#x8BB8;&#x4F7F;&#x7528;tab&#x952E;,&#x53EA;&#x5141;&#x8BB8;&#x4F7F;&#x7528;&#x7A7A;&#x683C;</li>
<li>&#x7F29;&#x8FDB;&#x7684;&#x7A7A;&#x683C;&#x6570;&#x76EE;&#x4E0D;&#x91CD;&#x8981;,&#x53EA;&#x8981;&#x76F8;&#x540C;&#x5C42;&#x7EA7;&#x7684;&#x5143;&#x7D20;&#x5DE6;&#x4FA7;&#x5BF9;&#x9F50;&#x5373;&#x53EF;</li>
</ol>
<h4 id="32-&#x652F;&#x6301;&#x7684;&#x6570;&#x636E;&#x7ED3;&#x6784;">3.2 &#x652F;&#x6301;&#x7684;&#x6570;&#x636E;&#x7ED3;&#x6784;</h4>
<ul>
<li><strong>object(&#x5BF9;&#x8C61;)</strong>, &#x952E;&#x503C;&#x5BF9;&#x7684;&#x96C6;&#x5408;,&#x53C8;&#x79F0;&#x4E3A;&#x6620;&#x5C04;/hash/&#x5B57;&#x5178;</li>
<li><strong>array(&#x6570;&#x7EC4;),</strong> &#x4E00;&#x7EC4;&#x6309;&#x7167;&#x6B21;&#x5E8F;&#x6392;&#x5217;&#x7684;&#x503C;,&#x53C8;&#x79F0;&#x5E8F;&#x5217;(sequence)&#x3001;&#x5217;&#x8868;</li>
<li><strong>scalars(&#x7EAF;&#x91CF;)</strong>, &#x5355;&#x4E2A;&#x7684;&#x3001;&#x4E0D;&#x53EF;&#x518D;&#x5206;&#x7684;&#x503C;, &#x5305;&#x62EC;<strong>&#x5B57;&#x7B26;&#x4E32;&#x3001;&#x5E03;&#x5C14;&#x503C;&#x3001;&#x6574;&#x6570;&#x3001;&#x6D6E;&#x70B9;&#x6570;&#x3001;null&#x3001;&#x65E5;&#x671F;</strong></li>
</ul>
<h4 id="33-&#x6570;&#x636E;&#x7ED3;&#x6784;&#x7684;&#x4F7F;&#x7528;">3.3 &#x6570;&#x636E;&#x7ED3;&#x6784;&#x7684;&#x4F7F;&#x7528;</h4>
<p><strong>(1)&#x3001;&#x5BF9;&#x8C61;</strong></p>
<ul>
<li><p>&#x503C;&#x4E3A;&#x5B57;&#x7B26;</p>
<pre><code class="lang-yaml">data.yaml
   animal: pets # &#x6CE8;&#x610F;&#x5192;&#x53F7;&#x540E;&#x9762;&#x5FC5;&#x987B;&#x8981;&#x6709;&#x4E00;&#x4E2A;&#x7A7A;&#x683C;

&#x8F6C;&#x6362;&#x4E3A;python&#x4EE3;&#x7801;
   {&apos;animal&apos;: &apos;pets&apos;}
</code></pre>
</li>
<li><p>&#x503C;&#x4E3A;&#x5B57;&#x5178;</p>
<pre><code class="lang-yaml">data.yaml
   animal: {&quot;ke1&quot;:&quot;pets&quot;,&quot;key2&quot;:&quot;app&quot;} # python&#x5B57;&#x5178;

&#x8F6C;&#x6362;&#x4E3A;python&#x4EE3;&#x7801;
   {animal: {&quot;ke1&quot;:&quot;pets&quot;,&quot;key2&quot;:&quot;app&quot;}} # &#x5D4C;&#x5957;&#x5B57;&#x5178;&#x7ED3;&#x6784;
</code></pre>
</li>
</ul>
<p><strong>(2)&#x3001;&#x6570;&#x7EC4;</strong></p>
<ul>
<li><p>&#x65B9;&#x5F0F;&#x4E00;</p>
<pre><code class="lang-yaml">data.yaml
   animal: 
     - data1
     - data2
&#x8F6C;&#x6362;&#x4E3A;python&#x4EE3;&#x7801;
   {&apos;animal&apos;: [&apos;data1&apos;, &apos;data2&apos;]}
</code></pre>
</li>
<li><p>&#x65B9;&#x5F0F;&#x4E8C;</p>
<pre><code class="lang-yaml">data.yaml
   animal: [&apos;data1&apos;, &apos;data2&apos;] # python&#x5217;&#x8868;

&#x8F6C;&#x6362;&#x4E3A;python&#x4EE3;&#x7801;
   {&apos;animal&apos;: [&apos;data1&apos;, &apos;data2&apos;]} # &#x5B57;&#x5178;&#x5D4C;&#x5957;&#x5217;&#x8868;
</code></pre>
</li>
</ul>
<p><strong>(3)&#x3001;&#x7EAF;&#x91CF;</strong></p>
<p>&#x4E3B;&#x8981;&#x5305;&#x62EC;: <strong>&#x5B57;&#x7B26;&#x4E32;&#x3001;&#x5E03;&#x5C14;&#x503C;&#x3001;&#x6574;&#x6570;&#x3001;&#x6D6E;&#x70B9;&#x6570;&#x3001;null&#x3001;&#x65E5;&#x671F;</strong></p>
<pre><code># &#x5B57;&#x7B26;&#x4E32;
data.yaml
     value: &quot;hello&quot;
&#x8F6C;&#x6362;&#x4E3A;python&#x4EE3;&#x7801;
     {&quot;value&quot;:&quot;hello&quot;}

# &#x5E03;&#x5C14;&#x503C;
data.yaml
     value1: true
     value2: false
&#x8F6C;&#x6362;&#x4E3A;python&#x4EE3;&#x7801;
     {&apos;value1&apos;: True, &apos;value2&apos;: False}

# &#x6574;&#x6570;&#xFF0C;&#x6D6E;&#x70B9;&#x6570;
data.yaml
     value1: 12
     value2: 12.102
# &#x8F6C;&#x6362;&#x4E3A;python&#x4EE3;&#x7801;
     {&apos;value1&apos;: 12, &apos;value2&apos;: 12.102}

# &#x7A7A;(Null)
data.yaml
     value1: ~ # ~ &#x8868;&#x793A;&#x4E3A;&#x7A7A;
&#x8F6C;&#x6362;&#x4E3A;python&#x4EE3;&#x7801;
     {&apos;value1&apos;: None}

# &#x65E5;&#x671F;
data.yaml
     value1: 2017-10-11 15:12:12
&#x8F6C;&#x6362;&#x4E3A;python&#x4EE3;&#x7801;
     {&apos;languages&apos;: {&apos;value1&apos;: datetime.datetime(2017, 10, 11, 15, 12, 12)}}
</code></pre><p><strong>(4)&#x3001;&#x951A;&#x70B9;&#x548C;&#x5F15;&#x7528;</strong></p>
<blockquote>
<p>&#x951A;&#x70B9;: &#x6807;&#x6CE8;&#x4E00;&#x4E2A;&#x5185;&#x5BB9;,&#x951A;&#x70B9;&#x540D;&#x79F0;&#x81EA;&#x5B9A;&#x4E49;, &#x6807;&#x793A;&#x7B26;&#x53F7;&#x662F; <strong>&amp;</strong></p>
<p>&#x5F15;&#x7528;: &#x88AB;&#x6807;&#x6CE8;&#x7684;&#x5185;&#x5BB9;. &#x6807;&#x793A;&#x7B26;&#x53F7;&#x597D;&#x662F;<strong>*</strong>,  &#x4F7F;&#x7528;&#x65B9;&#x5F0F;: &lt;&lt;: *&#x951A;&#x70B9;&#x540D;</p>
</blockquote>
<pre><code>data: &amp;imp   # &amp; &#x662F;&#x951A;&#x70B9;&#x6807;&#x793A;&#x7B26;&#x53F7;
    value: 456
name:
    value1: 123
    &lt;&lt;: *imp # &quot;&lt;&lt;:&quot; &#x5408;&#x5E76;&#x5230;&#x5F53;&#x524D;&#x4F4D;&#x7F6E;&#xFF0C;&quot;*imp&quot; &#x5F15;&#x7528;&#x951A;&#x70B9;imp
&#x8F6C;&#x6362;&#x4E3A;python&#x4EE3;&#x7801;
    {&apos;data&apos;: {&apos;value&apos;: 456}, &apos;name&apos;: {&apos;value&apos;: 456, &apos;value1&apos;: 123}}
</code></pre>
                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../day5/readme.html" class="navigation navigation-prev " aria-label="Previous page: 数据驱动--Yaml"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../day5/pyyaml.html" class="navigation navigation-next " aria-label="Next page: python解析yaml文件"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../gitbook/app.js"></script>

    
    <script src="../gitbook/plugins/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-splitter/splitter.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-chapter-fold/chapter-fold.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"expandable-chapters-small":{},"splitter":{},"chapter-fold":{},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2}};
    gitbook.start(config);
});
</script>

        
    </body>
    
</html>
